package com.qzsoft.system.modules.sysstation.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.qzsoft.jeemis.common.utils.Result;
import com.qzsoft.jeemis.common.validator.ValidatorUtils;
import com.qzsoft.system.modules.sysstation.entity.SysStationAsphaltSensorEntity;
import com.qzsoft.system.modules.sysstation.service.SysStationAsphaltSensorService;
import com.qzsoft.zhjd.common.utils.ResultUtils;

/**
 * @ClassName SysStationAsphaltSensorController
 * @Description 传感器校正控制器
 * @author linhuawei
 * @since 2021-11-25
 */
@RestController
@RequestMapping("/api/sysStationAsphaltSensor")
public class SysStationAsphaltSensorController {

    @Autowired
    private SysStationAsphaltSensorService sysStationAsphaltSensorService;

    /**
     * @Title info
     * @Description 获取传感器校正
     * @param id 主键
     * @return 传感器校正
     */
    @GetMapping("/info/{id}")
    public Result<SysStationAsphaltSensorEntity> info(@PathVariable("id") String id) {
        SysStationAsphaltSensorEntity data = sysStationAsphaltSensorService.getById(id);
        return ResultUtils.ok(data);
    }

    /**
     * @Title save
     * @Description 添加传感器校正
     * @param entity 传感器校正数据
     * @return 添加结果
     */
    @PostMapping("/save")
    public Result<String> save(@RequestBody SysStationAsphaltSensorEntity entity) {
        ValidatorUtils.validateEntity(entity);
        sysStationAsphaltSensorService.saveOrUpdate(entity);
        return ResultUtils.ok();
    }

}
